<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/


Route::get('/',function(){
    return view('welcome');
});

Route::get('/gg',['uses' => 'IndexController@index']);

//测试 HTTP 控制器


/**********************************************************************************************/

//Test
Route::group(['prefix'=>'test','middleware'=>[]],function(){

    Route::get('/testRedis',['uses'=>'TestController@redis']);

    Route::get('/index',['uses'=>'TestController@index','as'=>'test.index']);
    Route::get('/select',['uses'=>'TestController@select','as'=>'test.select']);
});


/**
 * 博客 路由
 */
Route::group(['prefix'=>'blog'],function(){

    Route::get('/',['uses'=>'BlogController@index']);

    Route::get('/{slug}',['uses'=>'BlogController@showPost']);

});

/**
 * 公共 方法
 */
Route::group(['middleware'=>[] , 'prefix' => 'test', 'as' => 'test.'],function(){

    /* 发送email */
    Route::get('email','TestController@email')->name('email');

});

/**
 * 用户 注册 登录
 */
Route::Auth();


/**
 * 统计 地图
 */
Route::group(['middleware'=>[] , 'namespace'=>'Map', 'prefix' => 'map' , 'as' => 'map.'],function(){

    /* 统计首页 */
    Route::get('index',['uses' => 'MapController@index' ])->name('index');

});



/**
 * dingo api 路由
 */
$api    =   app('Dingo\Api\Routing\Router');

$api->version('v1',function($api){

    /**
     * 获取用户
     */
    $api->get('user',['uses'=>'App\Api\V1\Controllers\UserController@index', 'as' => 'user.index']);

});

